package test.akka;

import akka.actor.ActorRef;
import akka.actor.Props;
import akka.actor.UntypedActor;

public class ParentActor extends UntypedActor {

	@Override
	public void onReceive(Object obj) throws Exception {
		if (obj.toString().equals("test")) {
			System.out.println("start !");
			ActorRef child = getContext().getChild("child");
			if (child == null) {
				System.out.println("create child !");
				child = getContext().actorOf(Props.create(ChildActor.class), "child");
			}
			System.out.println("end !");
		}

	}

}
